package com.example.permissionserviceconsumer.service;

import com.myprojects.common.pojo.Role;
import com.myprojects.common.dto.Msg;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@Service
@FeignClient(name = "permission-service",
        contextId = "role-service-api1",
        fallback = FeignRoleServiceFallback.class)
public interface FeignRoleService {

    /**
      * 该方法用于分页查询所有的用户信息(非员工)
      */
    @RequestMapping(value = "/role-curd/roles",method = RequestMethod.GET)
    @ResponseBody
    public Msg selectRolesByPageNum(
            @RequestParam(value = "pn",defaultValue = "1") Integer pageNum);

    /**
     * 该方法用于保存角色
     */
    @RequestMapping(value = "/role-curd/roles",method = RequestMethod.POST)
    @ResponseBody
    public Msg saveRole(@RequestBody Role role);

    /**
     * 该方法用于删除角色
     */
    @RequestMapping(value = "/role-curd/roles",method = RequestMethod.DELETE)
    @ResponseBody
    public Msg deleteRole(@RequestParam(value = "id") Integer id);

    /**
     * 该方法用于更新角色
     */
    @RequestMapping(value = "/role-curd/roles",method = RequestMethod.PUT)
    @ResponseBody
    public Msg updateRole(@RequestBody Role role);

    /**
     * 该方法用于分页查询所有的用户信息(非员工)
     */
    @RequestMapping(value = "/role-curd/resources",method = RequestMethod.GET)
    @ResponseBody
    public Msg getAllResources();
}
